<template>
    <div class="user">
        <h2>我是user:{{ $route.params.id }}</h2>
        <!-- 问题：有个{}占位 -->
        <h3>{{ $route.query }}</h3>
    </div>
</template>
<script setup>
import { useRoute, onBeforeRouteUpdate } from "vue-router"
// 1.第一次打印出来
const route = useRoute()
console.log("打印：", route.params.id);
// 2.路由跳转拿
onBeforeRouteUpdate((from, to) => {
    console.log("from", from.params.id);
    console.log("to", to.params.id);
})
</script>
<style scoped lang="less"></style>